Advertisement
Guest User

Untitled

a guest
May 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. 1.
  2. Given the database schema below for a school:
  3.  
  4. TotalAvailableCourses(CourseID , CourseName, ProfessorID)
  5. Professors(ProfessorID, ProfessorName)
  6. Students(StudentID, StudentName)
  7. StudentCourses(CourseID, StudentID)
  8.  
  9. Implement a query to get a list of all ProfessorID's that teach StudentCourses and the StudentCourses they teach. Note that TotalAvailableCourses and StudentCourses are different.
  10.  
  11. SELECT *
  12. FROM ProfessorID, CourseName
  13. WHERE TotalAvailableCourses
  14.  
  15.  
  16.  
  17.  
  18. 2.
  19. Given an array of unsorted integers, write a function to sort them
  20. in order from smallest to largest. You may write the function
  21. in any language of your choice. You may not use any built-in sort
  22. functions.
  23.  
  24. Example:
  25. Input: [1,7,5,6,8,9,9,100,24,35,10]
  26. Output: [1,5,6,7,8,9,9,10,24,35,100]
  27.  
  28. Function arr(list) {
  29. swapped = false
  30. For (var i=0; i<list.length; i++) {
  31. If (arr[i] = arr[i + 1]) {
  32. arr[i] = arr [i+1]
  33. arr[i+1] = arr[i]
  34. swapped = true
  35. }
  36. }
  37. return arr;
  38. }
  39.  
  40.  
  41.  
  42. 3.
  43. Write a binary search to search a sorted array for a given element.
  44.  
  45. For this search I would write a function that would allow me to
  46. split the sorted array into two halves then search each half for the given element.
  47. the search will continue to break the elements in half until the given element is found.
  48.  
  49. SQL
  50.  
  51. BINARY SEARCH
  52.  
  53. MEMORIZE ONE SORTING METHOD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement