موقع طلبة جامعة البحرين

يمكنك تصفح الموقع كزائر ولكن ندعوك لتسجيل عضوية خاصة بك لتحصل على كافة الصلاحيات مثل تنزيل ملفات المكتبة وقراءة تعليقات هيئة التدريس وغيرها. يمكنك الحصول على عضوية مجانية بالضغط على زر تسجيل. إذا قمت بالتسجيل مسبقا فيمكنك الضغط على زر دخول.

تسجيل دخول
  • قسم المكتبة الجامعية مغلق مؤقتا بعد الاستهداف التي تعرضت له بعض خدمات أمازون في البحرين، جاري استرجاع الملفات ونقلها إلى سيرفرات جديدة وسيتم بعدها اعادة افتتاح المكتبة

ITCS112 - ITCS104 - ITCS102 للفصل الصيفي 2014 - 2015

شنو معنى ذي السؤال وشلون ينحل؟؟؟؟؟؟؟؟؟؟

consider the following list:
9 25 49 69 80
using a binary search, how many comparisons are reqired to determine whether 49 is in the list or not?

consider the following list :
نفس الارقام
using a sequential search on an ordered list ,how many comparisons are required to drtermine whether 20 is in the list or not?
 
^^^^
I think - not sure- أنهم يبون جم مرة راح نقارن عشان نشوف اذا الرقم موجود في اللستة أو لا
 
consider the following list:
9 25 49 69 80
using a binary search, how many comparisons are reqired to determine whether 49 is in the list or not?

السٌؤال يقول،
إذا عندنا list = 9 25 49 69 80
نبّغي نبحَث عن العَدد 49 بإستخدام طريقـة الـباينري سيرج،
جَم مقارنة راح يسوي البرنامَج ؟
المعروف إنه الباينري سيـرج أول مايبدأ يبحث، يقارن العدد المطلوب، مع العدد اللي بـوسط الـليست
كود:
mid = (first + last -1 )
mid = ( 0 + 4 ) / 2
=2
يعني بيقارن مع الـ list [2] ، وبيلقاه
فالجواب مرّة وحدَة
,,
طولتها وإهي قصـيرة :nosweat:



​
 
عندي كمان سؤال:
write a function named BubbleSort that accepts two parameters array list of type integers and the number of element in the array lenght .the function should do:
1- sort the element of the array in descending order (largest to smallest)
2- count and return the number of swap (exchanges) made by the function .
هاي حلي ........... صح؟؟؟؟؟؟؟؟
كود:
int bubblesort(int list[], int length)
{
int i;
int index;
int temp;
for(i=0;i<length;i++)
{
for(index=0;index<length-i;index++)
if (list[index] < list[index+1])
{
temp=list[index];
list[index]=list[index+1];
list[index+1]=temp;
}
}
}
 


السٌؤال يقول،
إذا عندنا list = 9 25 49 69 80
نبّغي نبحَث عن العَدد 49 بإستخدام طريقـة الـباينري سيرج،
جَم مقارنة راح يسوي البرنامَج ؟
المعروف إنه الباينري سيـرج أول مايبدأ يبحث، يقارن العدد المطلوب، مع العدد اللي بـوسط الـليست
كود:
mid = (first + last -1 )
mid = ( 0 + 4 ) / 2
=2
يعني بيقارن مع الـ list [2] ، وبيلقاه
فالجواب مرّة وحدَة
,,
طولتها وإهي قصـيرة :nosweat:



​

مشكور اخوي على ردك
بس تحملني شوي :nosweat:
يعني الجواب رح يكون انه نكتب مرة واحدة بس
ما في خطوات نكتبها؟؟؟؟
 
^^
ما أعتِـقد،
,

كود:
int bubblesort(int list[], int length)
{
int i;
int index;
int temp;
for(i=0;i<length;i++)
{
for(index=0;index<length-i;index++)
if (list[index] < list[index+1])
{
temp=list[index];
list[index]=list[index+1];
list[index+1]=temp;
}
}
}


المَفروض صَح،
بس
2- count and return the number of swap (exchanges) made by the function .
ماحلّيتين هالجِزء :smile:
​
 
^^
ما أعتِـقد،
,

كود:
int bubblesort(int list[], int length)
{
int i;
int index;
int temp;
for(i=0;i<length;i++)
{
for(index=0;index<length-i;index++)
if (list[index] < list[index+1])
{
temp=list[index];
list[index]=list[index+1];
list[index+1]=temp;
}
}
}


المَفروض صَح،
بس

ماحلّيتين هالجِزء :smile:
​

جذي:
كود:
int bubblesort(int list[], int length)
{
int i;
int index;
int temp;
for(i=0;i<length;i++)
{
for(index=0;index<length-i;index++)
if (list[index] < list[index+1])
int count;
temp=list[index];
list[index]=list[index+1];
list[index+1]=temp;
return count;
}
}
 
int bubblesort(int list[], int length)
{
int i;
int index;
int temp;
for(i=0;i<length;i++)
{
for(index=0;index<length-i;index++)
if (list[index] < list[index+1])
int count ++;
{
temp=list[index];
list[index]=list[index+1];
list[index+1]=temp;
[return count;
}

لا،
عَرفي الكاونت ويّـه الجمَاعة فوق ،
وسوي لها انكريز بَعد الـ Swaps
عشان يحسِب عدَد المرات
وبعديـن سوي لها ريتورن
​
 
اوكي فهمت اخوي
مشكووووووووور وايد
غلبتك معاي
بالتوفيق
 
العَفو،
كلّه واحد :bleh:
جميـع إن شاء الله
​
 
Hi ..

i need [ Deleting ] and [ inserting ] codes as soon as posible plzzz

=(
 
مشكور اخوي much-sun على الوصلة
 
Hi ..

i need [ Deleting ] and [ inserting ] codes as soon as posible plzzz

=(

هذي فنكشن حق الـ insert


كود:
void INS(int arr[],int pos,int& len,int ne) 
{ 
    len++; 
    for(int i=len-1;i>pos;i--) 
        arr[i]=arr[i-1]; 
    arr[i]=ne; 
}

طريقة عمل الفنكشن,
احنا نعرف ان اللي نبيه ندخل شي في وسط عناصر الـ array
مثلاً لو كان عندي array بهذي الطريقة,
1 2 5 4
و أبي أدخل رقم 3 , بين الـ 5 و الـ 4 ,,
لازم أحرك الـ 5 و الـ 4 ,,
أزيد طول الـ array ( طبعاً لازم يكون مو أكثر من طول الـ array كامل, يعني لو كان طول الـ array طوله 5, أسوي,, اذا لا, ماقدر, نحط if قبل كل هالعفسة اذا نبي نختبر )

هذا الكود بيحرك ليي العناصر,,

كود:
for(int i=len-1;i>=pos;i--)
arr[i]=arr[i-1];
و بعدين نحط الرقم الجديد في مكانه
arr[i]=ne;

---------------------------------------------------------

و هذي فنكشن حق الديليت,


كود PHP:
كود:
void DEL(int arr[],int pos,int& len) 
{ 
    for(int i=pos;i<len;i++) 
        arr[i]=arr[i+1]; 
    len--; 
}

عملها بالضبط عكس الـ insert
كل اللي تسويه تسوي shift لكن لليسار,
و من دون ما أغير قيم, العنصر اللي أبي أخفيه بيختفي
و ننقص الطول,

و الطول في الـ 2 functions
مسوينه by reference
عشان اذا غيرناه في الفنكشن , يتغير في الـ main

يعطيـك العـافيـَة سيّد، :shiny:
​
 
J i 7 a عزيزتي بغيت أرد عليج بس ما صار
المهم الحل اللي تبينه موجود في هني جيكي الردود القبلية

بالتوفيق
 
structure

سؤال من امتحان سابق
حاولت احلة (جوفو ماحاولاتي صح او لا)

PART A [5 Points]
Define a struct named courseType, with members courseName(string), courseNo(string), and
courseCredits(int).
HTML:
struct coursetype{
string coursename;
string courseno;
int coursecredit;
};

Write a function named printCourseInfo which prints course information. The function accepts a
struct of type courseType named acourse as parameter. The function should print all the course
information.
HTML:
void printcourseinfo(coursetype course)
{
cout<<course.coursename<<course.courseno<<course.coursecredit;
}

PART C [8 Points]
Write a function named courseSearch that accepts an array courseList (struct courseType), size
(int), and cname (string). The elements of the array courseList are sorted in ascending order
accoreding to the courseName. The function should search for a course with cname as
courseName in courseList and return its position. Use any suitable search algorthim in a sorted
list.
HTML:
int coursesearch(coursetype list[], int size, string cname)
{
int i;
for(i=0;i<size;i++)
if(cname==list[i].coursename)
return i;
else 
return -1;
}

PART D [4 Points]
Define a structure named Student which includes members: id (long), name (string), array named
registeredCourses with element of type courseType, size (int) which is the number of elements in
the array registeredCourses. The maximum number of courses that any student can register in a
course is 8.
HTML:
struct student{
long id;
string name;
coursetype regcourse[8];
int size;
};

PART E [4 Points]
Write a function named displayStudent that prints all the information of the student including
registered courses information. Your function should call the function printCourseInfo defined
in part B.
اما ذي الجزء دار راسي فيه ماعرفت شلون اسويه
 
شنو سالفة الـiformation hidding في الكلاسس ؟
 
عندي جم سؤال في الكلاس يا ريت الي فاهمين الكلاس ما يبخلون علينا بردودهم
اول شي لما نكتب فنكشن الكلاس ونكتب البرنامج اول ما يتنفذ الكونستركتر صح ؟ ولما بيطلع من البرنامج يتنفذ الديكونستركتر صح ؟ هالشي يصير اوتوماتيكلي حتى لو ما سوينا اليه كول في المين ؟

والسؤال ثاني : الكونستركتر ينكتب ب3 اشكال ؟ شنو الفرق بينهم
اني اعرف ان لما يكتبون اليه كونستركتر مع ديفولت باراميتر نكتبه بهالصورة
exmple (int t=0 , string s ="", int m = 1(

والنوعين الباقين شلون نكتبهم ؟ ومتى

ان شاء الله عاد تفهمون لاسئلتي
وشكرا

)
 
انا عندي سؤال في لاري لين بنسوي السورت الترتيب من لاصغر لي لاكبر او العكس شنهي الفنكشن الي نكتبها .؟
 
في شي محذوف في الكلاسس
.أو لا ؟
 
عودة
أعلى أسفل