Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

On scratch paper, answer the following questions: a. When we study inheritance,

ID: 3849218 • Letter: O

Question

On scratch paper, answer the following questions: a. When we study inheritance, it seems like a potentially magical and far-reaching solution. But as we learn more about it and study other approaches, it becomes clear that interfaces are far more important and prevalent in programming. Explain why that is the case, citing at least three major reasons. b. Why are unit tests so important as a part of our deliverables as programmers? What are the key things that unit tests must report to us? What foundation for writing programmatic annotations and methods provide the foundation for writing programmatic tests using JUnit? Is having passing unit tests guarantee that software is bug free? Why or why not (give at least two reasons)? c. Define the terms "Tree, " "Binary Tree, " and "Binary Search Tree". What advantages does a BST provide, when it comes to adding node or searching for that is present or absent (be as technical as possible with your answer)? d. A friend of yours has taken an introductory programming class. She tells you she's heard event-driven programming, but doesn't know what it means or how it works. Define for her and the term for her and tell her how it is different from what she's done in the past. e. Define the term "Design Pattern". Why is it important that we study Design Patterns (give at least two reasons)? What three patterns did we discuss this quarter, either in detail or at a high level? f. List and describe the major components in the MVC approach. What is the major difference between the pure MVC model and the one we used in our Fractal project? g. Define the terms "Stack" and "Queue." What are the mnemonic acronyms associated with each. Say what each letter stands for. h. Fill in the table with the Big O Notation for time and space each of algorithms we've covered or complexity of the sorting reviewed.

Explanation / Answer

a) An interface is a reference type consisting of mainly abstract methods, static methods, and constants.

For example, An interface defined for a car, containing constants like the number of wheels and number of engine, and functions like accelerating forward, reversing and stopping. Now each car is required to perform these tasks, but the values and method for each car may vary.

For example, the defined interface for the car makes sure these requirements are completed by some car designed in future. So, the interface is like a contract to guarantee that the car performs all the basic required tasks defined in the interface. Hence, it gives the freedom to improve the tasks done by the car but also restricts it to perform some basic tasks alongside.

b) Unit tests help the programmer to ensure that each individual unit of the source code of a program associated with the procedures and usage data is free from errors. A good unit test is expected to provide the complete Bug report, i.e.,

JUnit provides the following basic annotations and methods:

Passing the unit test does not guarantee that software is Bug-Free, this is because a single module can be error free but it is not mandatory that when the modules are combined together, there occurs no error. It tests the units in isolation, there can be high complexity growth when modules are merged together.

c) Tree: is an Abstract Data Structure that forms a hierarchical structure which consists of a root and a left child subtree and a right child subtree, the nodes at nth level, act as the parent of those at (n+1)th level.

Binary Tree is a Tree where each node has at max 2 children. Every node except root is connected by one directed edge from its parent.

Binary Search Tree is one in which nodes are sorted to perform easy searching, A node serves as a separation parameter for its children. the left child of the node always has value less than the node, and right child has value more than the parent node.

The BST provides easy insertion and searching, as the nodes are added or searched based on the values:

d) Event driven programming is that domain of programming where a program is determined by the events such as receptors, sensors and user actions. Herein the further action of the application depends on the action taken based on the previous input. In such programs, there is a main loop which lists the events and then there are functions which define the task to be executed in response to those events. There are various events such as:

g) Stack and Queue are abstract data types.
A stack is a list in which the insertion and deletion take place at one end. While in a Queue to insertion take place at one end called as rear and deletion takes place at the other end called the front.
In a stack if the elements are inserted in the order: A,B,C,D then E; then while deletion E will be taken out first i.e., stack works in LIFO manner, which stands for Last In First Out.
There are two operations defined excusively for the stack data structure, first one is PUSH, which means to insert data in the stack and the other one is POP, which means to delete an element from the stack.
A common example is stack of plates.

In the queue, let the elements be inserted in the order :A,B,C,D then E; then while deletion A will be deleted first, followed by B and then C and so on, i.e., it follows FIFO ordering which stands for First In First Out, the elemeted inserted first will be the first to be taken out. The two exclusive operations for insertion and deletion in a queue are ENQUEUE and DEQUEUE respectively. A common example is any queue

h)

Selection Sort

Kindly Upvote if you find the answer Useful. Thank You. :)

Method Best(Time) Worst(Time) Worst(Space) Bubble Sort O(n) O(n2) O(1)

Selection Sort

O(n2) O(n2) O(1) Insertion sort O(n) O(n2) O(1) Merge Sort O(n log (n)) O (n log (n)) O(n) Quick Sort O(n log(n)) O(n2) O(log (n))
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote