Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- Given the database schema below for a school:
- TotalAvailableCourses(CourseID , CourseName, ProfessorID)
- Professors(ProfessorID, ProfessorName)
- Students(StudentID, StudentName)
- StudentCourses(CourseID, StudentID)
- 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.
- SELECT *
- FROM ProfessorID, CourseName
- WHERE TotalAvailableCourses
- 2.
- Given an array of unsorted integers, write a function to sort them
- in order from smallest to largest. You may write the function
- in any language of your choice. You may not use any built-in sort
- functions.
- Example:
- Input: [1,7,5,6,8,9,9,100,24,35,10]
- Output: [1,5,6,7,8,9,9,10,24,35,100]
- Function arr(list) {
- swapped = false
- For (var i=0; i<list.length; i++) {
- If (arr[i] = arr[i + 1]) {
- arr[i] = arr [i+1]
- arr[i+1] = arr[i]
- swapped = true
- }
- }
- return arr;
- }
- 3.
- Write a binary search to search a sorted array for a given element.
- For this search I would write a function that would allow me to
- split the sorted array into two halves then search each half for the given element.
- the search will continue to break the elements in half until the given element is found.
- SQL
- BINARY SEARCH
- MEMORIZE ONE SORTING METHOD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement