| ²é¿´: 77 | »Ø¸´: 0 | |||
| µ±Ç°Ö÷ÌâÒѾ´æµµ¡£ | |||
| ¡¾ÐüÉͽð±Ò¡¿»Ø´ð±¾ÌûÎÊÌ⣬×÷Õßnjlizhen½«ÔùËÍÄú 40 ¸ö½ð±Ò | |||
njlizhenÒø³æ (СÓÐÃûÆø)
|
[ÇóÖú]
javaÊÔÌâÇóÖú
|
||
|
ʱ¼äÏÞ¶¨ÔÚ½ñÌìÍíÉÏ֮ǰ£¬ÏÈлл¸÷λÁË£¡ 1. Given a sorted array of ints, write a method to remove the duplicates. Do not use any classes from the java.util package. example: 1,2,3,3,3,4,4,10,13,15,15,17 -> 1,2,3,4,10,13,15,17 int[] removeDuplicates(int[] vals) { } 2. Given two database tables EMPLOYEES COMPENSATION ________________________ _____________________ EMPID NAME SUPERVISOR EMPID BONUS ------------------------ --------------------- 34 Amy 17 5000 17 Ben 34 10 2000 5 Chris 34 34 5000 10 Don 5 ... ... A) Write a SQL statement to return the names of everyone who got a bonus greater than 1000. B) Given an EMPID write a SQL statement to return the names of everyone who directly reports to that person (everyone who has the person as a supervisor) C) GIVEN an EMPID Write a SQL statement to return everyone who is in that person's organization (everyone who either directly or who's supervisor ultimately reports to that person) 3. We define a Node in a binary tree to have a value and both left and right references to other Nodes. The left reference must point to either null or to a Node with a smaller value. The right reference must either point to null or to a Node with an equal or larger value. public Node { public int value; public Node left; public Node right; } We can build a tree by inserting one value at a time. The insertion is done by starting at the root and finding the first node with an appropriate null reference. If we insert 8,5,9,3,3,2,12,4,10 the tree at each step would look like: 8 8 5 8 5 9 8 5 9 3 8 5 9 3 3 8 5 9 3 2 3 8 5 9 3 12 2 3 8 5 9 3 12 2 3 4 8 5 9 3 10 12 2 3 4 A) Write a method that given the root Node prints out the all the values in sorted order. void printOrdered(Node node) { } B) Write a method that given the root Node of the tree inserts a new value. void insertValue(Node node, int value) { } C) If the tree has N nodes what is the average big O time for an insert? D) what is the worst case big O time for an insert? What would the input data look like to generate the worst case. [ Last edited by njlizhen on 2008-4-15 at 11:13 ] |
» ²ÂÄãϲ»¶
»¯¹¤Ñ§Ë¶294·Ö£¬Çóµ¼Ê¦ÊÕÁô
ÒѾÓÐ37È˻ظ´
Çóµ÷¼Á
ÒѾÓÐ11È˻ظ´
260Çóµ÷¼Á
ÒѾÓÐ4È˻ظ´
Ò»Ö¾Ô¸»ªÖÐũҵ071010£¬320Çóµ÷¼Á
ÒѾÓÐ19È˻ظ´
304Çóµ÷¼Á
ÒѾÓÐ7È˻ظ´
Ç󲩵¼£üÉúÎïÖÊ»ù¶à¿×̼/³¬¼¶µçÈÝ·½Ïò£¬ÒÑÓÐÏà¹Ø³É¹û£¬Ñ°ÄÜÔ´²ÄÁÏ/̼²ÄÁÏ·½ÏòÀÏʦ
ÒѾÓÐ3È˻ظ´
¶þ±½¼×ͪËáÀàÑÜÉúÎï
ÒѾÓÐ6È˻ظ´
½ÓÊÜÈκε÷¼Á
ÒѾÓÐ4È˻ظ´
Ò»Ö¾Ô¸Öпƴó²ÄÁÏÓ뻯¹¤£¬353·Ö»¹Óе÷¼ÁѧУÂð
ÒѾÓÐ12È˻ظ´
320Çóµ÷¼Á
ÒѾÓÐ4È˻ظ´













»Ø¸´´ËÂ¥
20