Skip to content
All Medium Articles
Recently I have gone through 10 rounds of interviews of my dream company Amazon for SDE1 and I got selected. My only resource and library… Read More
A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl<… Read More
The problem 3-SAT and 2-SAT are (A) both in P (B) both NP complete (C) NP-complete and in P respectively (D) undecidable and NP-complete respectively… Read More
What is the time complexity of the following recursive function: int DoSomething (int n)  {   if (n <= 2)     return 1;   else       return (DoSomething (floor(sqrt(n)))… Read More
A weight-balanced tree is a binary tree in which for each node. The number of nodes in the left sub tree is at least half… Read More
Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548,… Read More
Recently got interviewed with amazon Hyderabad for SDE1. Written 1) Given a BST, along with left and right pointer for a node, it has forward… Read More
Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3- ary max heap found in the above question,… Read More
Consider the following C program segment: char p[20];  char *s = "string";  int length = strlen(s);  int i;  for (i = 0; i < length;… Read More
Output of following program? #include<stdio.h>       int main()  {    int a[] = {1, 2, 3, 4, 5, 6};    int *ptr = (int*)(&a+1);    printf("%d ", *(ptr-1)… Read More
Given a Binary Tree, find size of the Largest Independent Set(LIS) in it. A subset of all tree nodes is an independent set if there… Read More
Which data structure is most efficient to find the top 10 largest items out of 1 million items stored in file? (A) Min heap (B)… Read More
In a village, people build houses in the same side of the road. A thief plans to loot the village. He wants maximum amount of… Read More
We describe a protocol of input device communication below. a. Each device has a distinct address b. The bus controller scans each device in sequence… Read More
Suppose there is a circle. There are n petrol pumps on that circle. You are given two sets of data. The amount of petrol that… Read More
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search? (A) N… Read More
You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate? (A) Heap… Read More
#include<stdio.h>  int main()  {    char *s[] = { "knowledge","is","power"};    char **p;    p = s;    printf("%s ", ++*p);    printf("%s ", *p++);    printf("%s ", ++*p);         return… Read More
#include<stdio.h> int main() {   typedef static int *i;   int j;   i a = &j;   printf("%d", *a);   return 0; } (A) Runtime Error (B) 0 (C)… Read More
#include <stdio.h> int main() {     int x = 5;     int const * ptr = &x;     ++(*ptr);     printf("%d", x);          return 0; } (A) Compiler Error… Read More

Start Your Coding Journey Now!