Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Algorithms And Data Structures (CS2321) assignment 1 solution

Rating
-
Sold
-
Pages
6
Grade
A
Uploaded on
14-09-2021
Written in
2019/2020

CS2321 assignment solution

Institution
Course

Content preview

Kingdom of Saudi Arabia ‫المملكة العـربية السعودية‬
Ministry of Higher Education ‫وزارة التعليم العالي‬
Prince Sattam bin Abdulaziz University ‫جامعة األمير سطام بن عبدالعزيز‬
College of Computer Engineering and Sciences ‫كلية هندسة وعلوم الحاسب‬
Computer Science Department ‫قسم علوم الحاسب‬
Course Title: Data Structures and Algorithms (CS2321) / 1438-1439 (1)
Homework 1 (Solutions)

(1)
a.
N N N
∑ (2i−1 )=2 ∑ i−∑ 1
i=1 i=1 i=1
N ( N +1)
=2 −N
2
=N 2 +N −N
=N 2
b.
The easiest way to prove this is by induction. The case N = 1 is trivial. Otherwise,




CS2321 – Homework 1 Page 1/1

, (2)
#include<iostream>
using namespace std;
void printOut(int x)
{
cout<<x%10<<endl;
if(x/10!=0)
printOut(x/10);
}



(3)
024
024
024
420

(4)
P1 P2
A B C
P1 ref to *P1 P2 ref to *P2
Initialization 10 15 20 null X null X
P1=&A 10 15 20 A 10 null X
P2=&C; 10 15 20 A 10 C 20
*P1=(*P2)++; 20 15 21 A 20 C 21
P1=P2; 20 15 21 C 21 C 21
P2=&B; 20 15 21 C 21 B 15
*P1-=*P2; 20 15 6 C 6 B 15
*P1*=*P2; 20 15 90 C 90 B 15
A=(*P2)++ * *P1; 1350 16 90 C 90 B 16
1350 16 90 135 16
P1=&A; A B
0
*P2=*P1/=*P2; 84 84 90 A 84 B 84




CS2321 – Homework 1 Page 2/1

Written for

Institution
Course

Document information

Uploaded on
September 14, 2021
Number of pages
6
Written in
2019/2020
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$3.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
InformationSystemsSTD

Also available in package deal

Get to know the seller

Seller avatar
InformationSystemsSTD prince sattam bin abdulaziz university
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
10
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions