Satish Kumar
BAN USERif the queue uses array internally
Insert - O(1), search O(n), dequeueO(1)
If the queue uses hash map internally
Insert - O(1), search O(1), dequeueO(n)
I would check why the optimisation is necessary
- Satish Kumar March 16, 2014Also the issue can be solve by using an extra space complexity of 0(N) and running time algorithm of 0(N) .
Use an array of size N-aN, traverse through the given array of elements and increment the no of occurences of each element in the list ,in the array aN.
Now traverse through the array aN, for every i th element find the i + k th element and calculate the no of pairs accordingly
The big endian and small endian issues come when there is type casting between pointers. At those points the corresponding changes can be done while initialising the pointers.
- Satish Kumar March 02, 2014The dial pad can take the input depending on the position of keys and store it in an array and call the number
- Satish Kumar March 02, 2014
1.If the array is sorted the largest element can be found at the end of array
- Satish Kumar March 19, 20142.If the array is not sorted traverse through the array find the max
3.If there are frequent insert options that can be taking place on the array along with the finding largest element,
- sort the array first
- do the insert options in the sorted order
- find largest element at the end of array