Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 31590

Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

2 votes

Stack using two queues

No, this is not efficient, if indeed it can be made to work. The pop operation has a loop that can iterate over N - 1 elements of an N deep stack. Typically both push and pop are expected to be cons …
sqykly's user avatar
  • 940
4 votes

Searching in an array in less than O(n) time

There are a lot of good answers here, but I felt like taking a stab at the question. If your task is to search the array with \$O(n)\$ or less complexity, I most smugly propose: int search(int[] dat …
sqykly's user avatar
  • 940