Sorting Algorithms: Bubble, Selection, Insertion, Merge, Quick
Understanding Sorting Algorithms
Algo Props: Well-defined inputs, clear & unambiguous, must be effective, must terminate.
Big O: Worst case (asymptotic tight upper). Big Omega: Best case (lower). Big Theta: Average.
N^2 Sorting Algorithms
n^2 Sorting: Bubble, Selection, Insertion (iterative)
Bubble Sort
Start with an unsorted array.
Loop through the array from the first element to the second-to-last element.
Compare each pair of adjacent elements.
If the current element is greater than the next element:
Read MoreUAE History: From Ancient Settlements to Modern Nation
Early Human Habitation in the UAE
- The earliest known human habitation in the UAE dates from 5500 BCE.
- Trade in copper from the Hajar Mountains started around 3000 BCE.
- By the 1st century AD, overland caravan traffic between Syria and cities in southern Iraq began.
- There was seaborne travel to the important port of Omana (present-day Umm al-Qaiwain) and then to India. These routes were an alternative to the Red Sea route used by the Romans.
- Pearls had been exploited in the area for millennia, but at this
Understanding Quality Management: TQM and Six Sigma
59) Developing a cultural environment for ethical behavior in an organization includes all of the following EXCEPT:
C) Redesign of a service or product to make it easier to produce.
60) “Quality at the source” implies: B) Lower scrap.
61) Which one of the following statements is a key feature of both TQM and Six Sigma? A) Quality is primarily the responsibility of all employees in the organization.
62) A firm’s internal program in employee involvement includes which of the following considerations?
Read MoreCustomer Feedback & Complaints: Gym, Hotels, Meals
Customer Feedback and Formal Complaints
Learning German: Student’s Perspective
Q1: Hi J. Nice to meet you. I have decided to learn German because I need to get a certificate to get into university. However, I don’t really like learning this language. I would prefer to study English.
Q2: I believe that the course is good because the teacher teaches very well and we are only three people in the class. But, on the other hand, I think it’s a drawback that the teacher isn’t a native speaker.
Q3: I would
Read MoreScala Collections: Lists, Sets, and Maps
Scala Lists
Lists are immutable sequences of elements of the same type.
var myList: List[String] = Nil var c: List[String] = Nil
Adding Elements to a List
c = "E" :: c(At front)c = c :+ "MEOW"(At end)
Removing Elements from a List
list diff List(num)
List Operations
List.range(0, 10, 2): Creates a list of numbers from 0 to 10 (exclusive), with a step of 2.var x = List.fill(3)("foo"): Creates a list with three elements, all initialized to “foo”.var x = List.tabulate(5)(n => n * n): Creates a list
Feedback and Suggestions: Gym, Hotel, and Food Services
Student’s Feedback on German Course
Q1. Hi J. Nice to meet you. I have decided to learn German because I need to get a certificate to get into university. However, I don’t really like learning this language. I would prefer to study English.
Q2: I believe that the course is good because the teacher teaches very well and there are only three people in the class. But, on the other hand, I think it’s a disadvantage that the teacher isn’t a native speaker.
Q3: I would feel happy because the teacher, who
