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

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

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

ITCS215 للفصل الدراسي الثاني 2015 - 2016

Blue Castle

اا Moderator - I.T. College اا
طاقم الإدارة
تاريخ التسجيل
19 أبريل 2013
المشاركات
1,638
المجموعة
ذكر
الدفعة الدراسية
2012
الكلية
كلية تقنية المعلومات
التخصص
Computer Science
السلام عليكم و رحمة الله و بركاته


تم فتح هذا الموضوع لمناقشة مقرر ITCS215


قسم المقرر في المكتبة الجامعية
https://www.uob-bh.com/forum/downloads.php?do=cat&id=5


لأي استفسارات أو مساعدة تتعلق بالمقرر الرجاء طرحها هنا


بالتوفيق للجميع
​
 
السلام عليكم
لو سمحتم هل في اسىله مع حلول للماده ؟؟؟
215اي تي يس اس
 
مشكووريييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييييين
 
(10) Write a function (not a member function) called reorderAt that takes two objects L1 and L2 of type arrayListType as parameters. The function reorders the elements of L1 based on the values in L2. For each element in L1 there is a corresponding number in L2 such that the number in L2 represents the new position/index for the element to be placed in L1. In other words, the number in L2 specifies the index where the element should be re-placed in L1. L2 is of the same size as L1.

Assume that the positions specified by elements of L2 are valid positions.

Example

Array of L1: { a b c d }
clip_image001.gif
Array of L2: { 3 0 2 1 }


After function call array of L1 will be { b d c a }

clip_image002.gif
0 1 2 3

The function prototype:

void reorderAt( arrayListType<Type>& L1, arrayListType<Type>& L2 );


Hint: Create a new list L3 as a copy of list L1. Replace elements of L3 by elements of L1 at position specified by list L2. Assign L3 to

ممكن حل لهذا السوال؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
 
(10) Write a function (not a member function) called reorderAt that takes two objects L1 and L2 of type arrayListType as parameters. The function reorders the elements of L1 based on the values in L2. For each element in L1 there is a corresponding number in L2 such that the number in L2 represents the new position/index for the element to be placed in L1. In other words, the number in L2 specifies the index where the element should be re-placed in L1. L2 is of the same size as L1.

Assume that the positions specified by elements of L2 are valid positions.

Example

Array of L1: { a b c d }
clip_image001.gif
Array of L2: { 3 0 2 1 }


After function call array of L1 will be { b d c a }

clip_image002.gif
0 1 2 3

The function prototype:

void reorderAt( arrayListType<Type>& L1, arrayListType<Type>& L2 );


Hint: Create a new list L3 as a copy of list L1. Replace elements of L3 by elements of L1 at position specified by list L2. Assign L3 to

ممكن حل لهذا السوال؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟


كود:
template <class elemType>
void reorderAt( arrayListType<elemType>& L1, arrayListType<int>& L2 ){
         elemType item;
         int loc;
  
     arrayListType<elemType> L3(L1);
  
     for(int i=0; i< L1.listSize(); i++)
     {
      L1.retrieveAt(i,item);
     L2.retrieveAt(i,loc); 
  
     L3.replaceAt(loc,item);     
     }
     L1=L3;
 
}

تقدرين تستعملين insertAt بدل
كود:
     L3.replaceAt(loc,item);
 
التعديل الأخير:
عودة
أعلى أسفل