1) You have a nxn matrix that contains integers only.
a.    The numbers always increase to the right and to the bottom
b.    What is the fastest way to find a number x (you know it is in the matrix)

2) 4 people must cross a bridge.
a.    Only 2 people can walk a bridge at the same time because it is dark and they have to carry a flashlight with them.
b.    Once 2 people cross the bridge one of them must return the flashlight so that the rest can cross it
i.    First person can cross the bridge in 10 minutes
ii.    Second in  5 minutes
iii.    Third in 2 minutes
iv.    Fourth in 1 minutes
How long will it take them all to cross the bridge?
They are in hurry and must do it as fast as possible

3) Write an algorithm to convert integers to words.
a.    i.e. 1234 must be spelled as one thousand thirty four

4) Write an algorithm to reverse a single-linked list

5) Write an algorithm to draw a star with n corners
a.    You have 2 functions to use: moveto(x,y) lineto(x,y)

6) Write an algorithm to add a node to a singly-linked list
7) You have a table A that contains managers with their ManagerID and Name and table B that contains employees with their EmployeeID, Name, and reference to their manager (ManagerID).
a.    Write a SQL statement to display all Employee names with their manager names.
b.    Modify the statement to display employees that do not have a matching manager

8) You have a b-tree How would you store it in a relational database? (Design the schema)

Leave a Reply

− seven = 0