Description

Description

see

College of Computing and Informatics

Assignment 2
Deadline: Sunday 13/04/2025 @ 23:59
[Total Mark for this Assignment is 8]
Student Details:
Name: ###

ID: ###

CRN: ###
Instructions:

• You must submit two separate copies (one Word file and one PDF file) using the Assignment Template on
Blackboard via the allocated folder. These files must not be in compressed format.

• It is your responsibility to check and make sure that you have uploaded both the correct files.
• Zero mark will be given if you try to bypass the SafeAssign (e.g. misspell words, remove spaces between
words, hide characters, use different character sets, convert text into image or languages other than English
or any kind of manipulation).

• Email submission will not be accepted.
• You are advised to make your work clear and well-presented. This includes filling your information on the cover
page.

• You must use this template, failing which will result in zero mark.
• You MUST show all your work, and text must not be converted into an image, unless specified otherwise by
the question.

• Late submission will result in ZERO mark.
• The work should be your own, copying from students or other resources will result in ZERO mark.
• Use Times New Roman font for all your answers.

Restricted – ‫مقيد‬

Question One

Pg. 01
Learning
Outcome(s):
CLO4:
Demonstrate
implemented
solution with
appropriate data
structure and
algorithm for the
assigned
problem.

Question One

2 Marks

What is the main property of a binary search tree, and how does this property
affect the way data is organized and searched within the tree?
A binary search tree is a hierarchical structure that follows a specific ordering
principle. Each node in the tree has a value, and all elements in its left subtree are
smaller than the node’s value, while all elements in its right subtree are greater than the
node’s value. This organization ensures that data remains sorted, allowing for efficient
searching, insertion, and deletion (Lorenzen et al., 2023).
The properties of a binary search tree directly impact the way data is managed and
retrieved. Searching for a specific value is highly efficient because the tree can be
traversed in a logarithmic manner. The process begins at the root and moves left or
right based on whether the target value is smaller or larger than the current node. This
approach eliminates the need for scanning all elements, which would be necessary in
an unsorted list or array. Additionally, the structure of the binary search tree allows for
efficient range queries and ordered data retrieval using an in-order traversal, which
visits nodes in ascending order. However, the efficiency of these operations depends
on whether the tree remains balanced. An unbalanced binary search tree can slow
down operations, making balancing techniques such as self-adjusting trees necessary to
maintain optimal performance (Xu, 2022).

Restricted – ‫مقيد‬

Question Two

Pg. 02
Learning
Outcome(s):
Describe basic
and advanced
data structures
such as linked
lists, stacks, and
queues

Question Two

2 Marks

Why is rehashing necessary in a hash table, and what are the key steps
involved in the rehashing process?
Rehashing becomes necessary when the hash table reaches a high load factor, meaning
that a significant portion of its slots are occupied, leading to increased collisions and
degraded performance. As the number of elements grows, the probability of multiple
keys mapping to the same index rises, causing longer probe sequences and slower
operations. To maintain optimal efficiency, rehashing expands the hash table size and
redistributes existing elements using a new hash function (Heller, 2022).
The rehashing process involves several key steps. First, the load factor is monitored,
and when it exceeds a predefined threshold, a new, larger hash table is allocated.
Typically, the new size is chosen as a prime number to minimize clustering and
improve distribution. Next, all elements from the old table are reinserted into the new
table using a recalculated hash function, ensuring that each key is mapped to an
appropriate index. Since the table size has changed, the hash values of existing
elements are recomputed, preventing previous collisions from persisting. This
restructuring enhances lookup speed and reduces the likelihood of performance
degradation. Rehashing is an essential technique for maintaining efficiency in dynamic
hash tables, ensuring that operations remain fast and scalable as data volume increases
(Department of Computer Science, n.d.).

Restricted – ‫مقيد‬

Question Three

Pg. 03
Learning
Outcome(s):

Question Three

2 Marks

Compare the two sorting algorithms for sorting the list in the previous
question in terms of the following:
CLO2: Outline the
differences
between different
data structures as
well as searching
and sorting
algorithms

1. Which algorithm required fewer operations?
Merge sort generally requires fewer operations than insertion sort when dealing with
large datasets. This is because merge sort follows a divide-and-conquer approach,
breaking the list into smaller parts, sorting them, and then merging the results
efficiently. The time complexity for merge sort is O(n log n) in all cases, meaning it
scales well for larger inputs. In contrast, insertion sort checks each element one by one
and places it in its correct position by shifting existing elements. This results in an
O(n²) time complexity in the worst case, meaning that as the number of elements
grows, the number of comparisons and shifts increases significantly (Pal Singh Bedi &
Kaur, 2022).
2. How would the performance change if the list were already sorted
(e.g., [A, E, E, L, M, P, X])?
If the list is already sorted, insertion sort performs significantly better because it only
needs to check that each element is in its proper position. Since no shifting is required,
insertion sort completes in O(n) time, making it very efficient in this scenario. On the
other hand, merge sort does not take advantage of an already sorted list. It still divides
and merges the list, maintaining its standard O(n log n) time complexity. This means
that for small or mostly sorted datasets, insertion sort is far superior in terms of
efficiency (Khaznah et al., 2022).

Restricted – ‫مقيد‬

Question Four

Pg. 04
Learning
Outcome(s):
Demonstrate
implemented
solution with
appropriate data
structure and
algorithm for the
assigned problem

Question Four

2 Marks

Sort the list [ E, X, A, M, P, L, E ] in alphabetical order using both Insertion
sort and Merge sort. Show all your steps.
Insertion Sort
Insertion Sort works by picking elements one by one and inserting them into their
correct position among the already sorted elements.
Initial List: [E, X, A, M, P, L, E]
Step-by-step execution:
1. Consider the second element X. It is already larger than E, so the list remains
unchanged: [E, X, A, M, P, L, E]
2. Consider the third element A. Move it left past X and E: [A, E, X, M, P, L, E]
3. Consider M. Move it left past X: [A, E, M, X, P, L, E]
4. Consider P. Move it left past X but keep it after M: [A, E, M, P, X, L, E]
5. Consider L. Move it left past X, P, and M: [A, E, L, M, P, X, E]
6. Consider the last E. Move it left past X, P, and M: [A, E, E, L, M, P, X]
Final Sorted List (Insertion Sort): [A, E, E, L, M, P, X]
Merge Sort
Merge Sort follows a divide-and-conquer approach where the list is split into smaller
parts, sorted individually, and then merged back together.
Step-by-step execution:
1. Split the list into two halves:

Restricted – ‫مقيد‬

Question Four

Pg. 05
o

Left: [E, X, A]

o

Right: [M, P, L, E]

2. Recursively split until each part contains one element:
o

Left half splits into [E] and [X, A]

o

[X, A] splits into [X] and [A]

o

Right half splits into [M, P] and [L, E]

o

[M, P] splits into [M] and [P]

o

[L, E] splits into [L] and [E]

3. Merge sorted parts:
o

[X] and [A] merge into [A, X]

o

[E] and [A, X] merge into [A, E, X]

o

[M] and [P] merge into [M, P]

o

[L] and [E] merge into [E, L]

o

[M, P] and [E, L] merge into [E, L, M, P]

o

Finally, [A, E, X] and [E, L, M, P] merge into [A, E, E, L, M, P, X]

Final Sorted List (Merge Sort): [A, E, E, L, M, P, X]

Restricted – ‫مقيد‬

Question Four

Pg. 06
References

Department of Computer Science. (n.d.). Hash tables: Rehashing. In University of
Vermont, University of Vermont. University of Vermont.

Heller, S. (2022). Challenges and opportunities in developing a hash table optimized
for persistent memory. In Storage Developers Conference.

Khaznah, A., Wala, A., Sahar, A., Fatimah, A., Narjis, A., & Azza, A. (2022). Analysis
and comparison of sorting algorithms (Insertion, Merge, and HEAP) using Java.
koreascience.kr.
Lorenzen, A., Leijen, D., Swierstra, W., & Lindley, S. (2023). The functional essence
of imperative binary search trees. In Microsoft Research, Microsoft Technical
Report.
Pal Singh Bedi, H., & Kaur, A. (2022). Comparative Study of Different Sorting
Algorithms used in Data Structures. INTERNATIONAL JOURNAL OF
RESEARCH CULTURE SOCIETY, 6(3), 114–117.

Xu, Z. (2022). Breadth-First Search Multi-Dimensional Binary Search Tree based
Algorithms for Structural. Science Gate.

Restricted – ‫مقيد‬

Purchase answer to see full
attachment

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Description

Description the title 68Ga-DOTA-TOC-injection (EP) in NETs arised from neuroendocrine cells the reference more than4 Vancouver style follow the rubric in the file Students Case Study Rubric Course: RNM 417 Student: ……………………………………………. Case study title: ………………………………..…… Criteria Needs Unsatisfactory (1) Satisfactory (3) Improvement Excellent (4) (2) 1. Patient’s Minimal Basic

Description

Description write case study about this title [18F]NaF is used in blood flow studies reference more than 4Vancouver follow the rubric in the file make sure 0% AI

Description

Description Action Items An e-mail is sent to Party B, in order to form a contract. Party A is the sender of the email. Party A’s identification is located at the top of the e-mail and is sufficient to show authentication. Will use of the individual’s initials or name at

Description

Description Kindly review the attached document for your assistance in explanation and answer and please note that the deadline is on 26 of April at 00:00, KSA timing. Your usual assistance in highly appreciated. ‫المملكة العربية السعودية‬ ‫وزارة التعليم‬ ‫الجامعة السعودية اإللكترونية‬ Kingdom of Saudi Arabia Ministry of Education Saudi

Description

Description General Instructions – PLEASE READ THEM CAREFULLY The Assignment must be submitted on Blackboard (WORD format only) via the allocated folder. Assignments submitted through email will not be accepted. Students are advised to make their work transparent and well-presented; marks may be reduced for poor presentation. This includes filling

Description

Description The Assignment must be submitted on Blackboard (WORD format only) via the allocated folder. Assignments submitted through email will not be accepted. Students are advised to present their work clearly and well, as marks may be reduced for poor presentation. This includes filling in your information on the cover

Description

Description see Communications an Operations Securit (COMSEC & OPSEC) Introduction to Communications Security (COMSEC) & Operations Security (OPSEC) SECURITY ● Communications Security (COMSEC) secures data transmission through encryption and secure channels. ● Operations Security (OPSEC) protects daily operations by enforcing security policies and protocols. ● Both approaches prevent unauthorized access,

Description

Description College of Administration and Finance Sciences Form No 4- Internship Report Cover Page Student`s name: Student`s ID #: Training Organization: Trainee Department: Field Instructor Name: Field Instructor Signature: Course Title: Internship-MGT430 CRN: 25422 Internship Start Date: Internship End Date: Academic Year/Semester:2024-2025/2nd For Instructor’s Use only Instructor’s Name: Dr. Sager

Description

Description I have an Assignment for SKL401 I need your help to solve it do as instructed , Important Notes: Keep your total submission to one page only. Make sure your work is your own. please no AI (chat gpt .. etc) SKL401 – Assignment #3 Topic: Market Analysis Deadline

Description

Description Students are advised to make their work clear and well presented; marks may be reduced for poor presentation. This includes filling your information on the cover page. • Students must mention question number clearly in their answer. • Late submission will NOT be accepted. • Avoid plagiarism, the work

Description

Description Students are advised to make their work clear and well presented; marks may be reduced for poor presentation. This includes filling your information on the cover page. • Students must mention question number clearly in their answer. • Late submission will NOT be accepted. • Avoid plagiarism, the work

Description

Description Students are advised to make their work clear and well presented; marks may be reduced for poor presentation. This includes filling your information on the cover page. • Students must mention question number clearly in their answer. • Late submission will NOT be accepted. • Avoid plagiarism, the work

Description

Description Students are advised to make their work clear and well presented; marks may be reduced for poor presentation. This includes filling your information on the cover page. • Students must mention question number clearly in their answer. • Late submission will NOT be accepted. • Avoid plagiarism, the work

Description

Description •Please write the solution to Part (B) based on the case study attached with the assignment file. •Each answer should be within the range of 250 to 300 word counts. Please support your answers with examples and clear explanation. Avoid originality, similarity and plagiarism, Do not copy or quote

Description

Description ••Each answer should be within the range of 350 to 400 word counts. Please support your answers with examples and clear explanation. Avoid originality, similarity and plagiarism, Do not copy or quote from any sources and you must paraphrase. All references must be cited using APA format. All answered

Description

Description ••Each answer should be within the range of 100 to 150 word counts. Please support your answers with examples and clear explanation. Avoid originality, similarity and plagiarism, Do not copy or quote from any sources and you must paraphrase. All references must be cited using APA format. All answered

Description

Description • Answer questions 1 and 4 in no less than 400 words. Answer questions 2 and 3 in no less than 250 words. You must refer to the case that I attached with the assignment. Please support your answers with examples and clear explanation. Avoid originality, similarity and plagiarism,

Description

Description MGT685: Capstone (Simulation) Guidelines & Requirements Phase three: (current phase) Since the project is accepted and finalized by the supervisor, based on it we need to develop a PowerPoints & Presentation speech. Length: PowerPoint: 13 slides Presentation speech: based in the PowerPoint Presentation Guidelines (Important) Presentation time allotted to