15,911,891 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mike@codeproject (Top 6 by date)
mike@codeproject
9-May-21 14:36pm
View
... since log_a(x) = log_b(x) * (1 / log_b(a)) for any bases a > 1 and b > 1.
mike@codeproject
9-May-21 14:32pm
View
The base of a logarithm doesn't matter in big-O or big-theta notation. O(log x) = O(ln x) = O(lg x) = O(log_b x)
mike@codeproject
24-Apr-21 1:00am
View
The Python syntax a R1 b R2 c translates (by definition) to (a R1 b) and (a R2 c), where R1,R2 are any comparison operators. So 0 < x < 1 does the expected thing (0 < x) and (x < 1), but also other combinations are possible: a==b==c tests for three numbers being equal, while 1 != x < 0 tests for a positive number that's not 1 (e.g. the domains of a logarithm.) This is handy when the central value is a complicated expression.
OP's syntax is not C++, though, and (as you have observed) isn't what he wanted even if it were allowed.
mike@codeproject
22-Apr-21 14:52pm
View
What I forgot to mention in my answer was that you should get the first part coded and fully tested before worrying about--or asking questions about--later parts of the assignment. It's pointless to talk about how to find the average/maximum/minimum of a sequence of k values when you haven't yet figured out how to generate those values. Step 1 is to get your input, step 2 is to use the input to generate the required sequence of k values. Get those done, in order if you don't want to go crazy, and ask about the first problem you can't solve on your own--not about the whole assignment.
mike@codeproject
22-Apr-21 14:37pm
View
Okay, I misunderstood. FWIW, if OP had a Computer Science Concepts class, that could be a source. That's a warm-up for AP Computer Science, often based on Python (but JS can also be used) and that triple inequality syntax is valid in Python. Thanks again.
mike@codeproject
22-Apr-21 11:46am
View
Thanks for the vote! Are you going to write two if statements on an array bounds test, though? I'd use (i < 0 || i >= n) every time. It's a pretty standard pattern for a "not in interval" test.
Show More