Sunday, March 15, 2020

Data Structure

---------------------------------------------------------------------------------
HASHING TABLE & BINARY TREE
---------------------------------------------------------------------------------


Hashing Table
Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value. Access of data becomes very fast if we know the index of the desired data.

Hashing
Hashing is a technique to convert a range of key values into a range of indexes of an array. We're going to use modulo operator to get a range of key values. Consider an example of hash table of size 20, and the following items are to be stored. Item are in the (key,value) format.
  1. (1,20)              
  2. (2,70)
  3. (42,80)
Sr.No.
Key
Hash
Array Index
1
1
1 % 20 = 1
1
2
2
2 % 20 = 2
2
3
42
42 % 20 = 2
2

Linear Probing

The hashing technique is used to create an already used index of the array. In such a case, we can search the next empty location in the array by looking into the next cell until we find an empty cell. This technique is called linear probing.

Sr.No.
Key
Hash
Array Index
After Linear Probing, Array Index
1
1
1 % 20 = 1
1
1
2
2
2 % 20 = 2
2
2
3
42
42 % 20 = 2
2
3

Basic Operation
  1. Search 
           Whenever an element is to be searched, compute the hash code of the key passed and locate the element using that hash code as index in the array. Use linear probing to get the element ahead if the element is not found at the computed hash code.

      2. Insert

          Whenever an element is to be inserted, compute the hash code of the key passed and locate the index using that hash code as an index in the array. Use linear probing for empty location, if an element is found at the computed hash code.

      3. delete

           Whenever an element is to be deleted, compute the hash code of the key passed and locate the index using that hash code as an index in the array. Use linear probing to get the element ahead if an element is not found at the computed hash code. When found, store a dummy item there to keep the performance of the hash table intact.

Binary Tree
Hasil gambar untuk binary tree
A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child. A Binary Tree node contains following parts
  1. Data
  2. Pointer to left child
  3. Pointer to right child

Monday, January 7, 2019

Experiences

How are you friends? Insyaallah all my friends are healthy right? if  you hungry u have to eat, if you thirsty you must drink, if you are sleepy then you have to sleep, if you are tired you have to rest because I don't wanna see my brother in faith sick 😉. By the way, are there friends who intend to become hafidz quran? Do you guys know the virtues of hafidz quran are many?

                  

Virtues of Hafidz Quran
Memorizing the Qur'an is worship, where the culprit expects the face and reward of Allah in the Hereafter. Without this intention, he would not get rewarded even be tortured for turning this worship to other than Allah SWT.
Allah has given specificity to the memorizers of the Qur'an with some specialties in the world and in the hereafter, including:

1. That he takes precedence over others in prayer as an imam.
" يؤم القوم أقرؤهم لكتاب الله فإن كانوا في القراءة سواء فأعلمهم بالسنة فإن كانوا في السنة سواء فأقدمهم هجرة فإن كانوا في الهجرة سواء فأقدمهم سلما ولا يؤمن الرجل الرجل في سلطانه ولا يقعد في بيته على تكرمته إلا بإذنه. رواه مسلم (673)
"Those who lead a people are the most memorized of the Book of God. if the reading (memorization) is the same, then who knows the sunnah better. The sunnah is the same, then the first one is hijrah. If the migration is the same, then the first to enter Islam. And don't be a priest over his brother in his power. And don't sit in a special seat in his house except with his permission. HR. Muslim, 673.

2. other precedence in the grave is faced with the qibla if it requires to be buried together with others.
كان النَّبي صلى الله عليه وسلم يجمع بين الرجلين من قتلى " أحد " في ثوب واحد ثم يقول : أيهم أكثر أخذاً للقرآن ؟ فإذا أشير له إلى أحدهما قدَّمه في اللحد وقال : أنا شهيد على هؤلاء يوم القيامة وأمر بدفنهم في دمائهم ولم يغسلوا ولم يصل عليهم. رواه البخاري (1278)
"In the past the Prophet sallallaahu alaihi wa sallam gathered two people who died in the 'Battle of Uhud' in one shirt then he said," Who among them takes the Qur'an the most? When one of them is appointed, he goes first to the burial hole. As he said, "I became a witness for them on the Day of Judgment. And he ordered to bury it with blood without bathing and without dishalati. "HR. Bukhori, (1278)

3. Leadership takes precedence if he is able to carry it out.
Nafi 'bin Abdul Harits met Umar at Asfan. Where before Umar had appointed him in Mecca. So he said, "Who did you appoint to the inhabitants of Wadi (Mecca)? So he replied, "Ibn Abza? (Umar) asked, "Who is Ibn Abza? Answered, "Among our slaves. Say, "Do you lift for them a slave? Answered, "He is the reader (memorizer) of the Book of Allah Azza Wajalla and he is good at the field of Faroid (the science of inheritance). So Umar said, "Then in fact your Prophet all sallallaahu alaihi wa sallam said," Verily Allah raises with this Book a people and demeans others. "HR. Muslim, 817.

4. The position of hafidz Quran is at the end of the verse that is memorized.
" يقال لصاحب القرآن : اقرأ وارتق ورتل كما كنت ترتل في الدنيا فإن منزلتك عند آخر آية تقرأ بها "


رواه الترمذي (2914) و قال : هذا حديث حسن صحيح ، وقال الألباني في " صحيح الترمذي برقم (2329) : حسن صحيح ، وأبو داود (1464) "
"It was said to the owner of the Qur'an," Read and ride and read in tartil. As you read the tartil in the world. Because of your position in the last verse you read. "HR. Tirimizi, (2914) and commented: This hadith is Hasan Shoheh. Albani commented on Shoheh Tirmizi no. 2329 Hasan Shoheh. Abu Dawud, (1464).

5. He is with the Angels who accompanied him at his home.
مثل الذي يقرأ القرآن وهو حافظ له مع السفرة الكرام البررة ومثل الذي يقرأ وهو يتعاهده وهو عليه شديد فله أجران. رواه البخاري (4653) و مسلم (798)
"The parable of someone who reads the Qur'an while he has memorized it. Then be with the noble angels. And the parable that reads in a condition of trying hard (learning to read it) then he gets two rewards." HR. Bukhori, 4653 and Muslim, 798.

6. He will be given a crown of glory and a bracelet of glory.
: يجيء القرآن يوم القيامة فيقول : يا رب حلِّه ، فيلبس تاج الكرامة ثم يقول : يا رب زِدْه ، فيلبس حلة الكرامة ، ثم يقول : يا رب ارض عنه فيرضى عنه ، فيقال له: اقرأ وارق وتزاد بكل آية حسنة " . رواه الترمذي ( 2915 ) وقال : هذا حديث حسن صحيح ، وقال الألباني في " صحيح الترمذي " برقم ( 2328 ) : حسن .
"The Qur'an comes on the Day of Judgment and says," O Lord, wear it. So he used the crown of karomah (kemulyaan) then said, "O Lord, add him. So he wore a karomah bracelet (glory). Then said, "O Lord, redo him, then (Allah) redeemed him. It was said to him, "Read and ride. Plus every verse is a kindness. "HR. Tirmizi, (2915) and said, "This hadith is Hasan Shoheh. Albani said at Shoheh Tirmizi, no. 2328. Hasan.

7. The Qur'an will give intercession to him by the side of Allah SWT.
اقرءوا القرآن فإنه يأتي يوم القيامة شفيعا لأصحابه اقرءوا الزهراوين البقرة وسورة آل عمران فإنهما تأتيان يوم القيامة كأنهما غمامتان أو كأنهما غيايتان أو كأنهما فرقان من طير صواف تحاجان عن أصحابهما اقرءوا سورة البقرة فإن أخذها بركة وتركها حسرة ولا تستطيعها البطلة قال معاوية بلغني أن البطلة السحرة. رواه مسلم (804) و البخاري معلقا
"Read the Qur'an, because it will come on the Day of Judgment to be intercession to its owner. Read Zahrawain (two lights) surat Al-Baqarah and Surat Ali Imran. Because both will come on the Day of Resurrection like a cloud or like a cloud or like two groups of birds that are hairy (helping) blocking their owners. Read the letter Al-Baqarah, because it takes blessings and leaves it a loss. Dan (sorcerer) cannot (disturb him). Muawiyah said, it came to me that the meaning of ‘Batolah‘ was a sorcerer. HR. Muslim, (804) and Bukhori by hanging.

Data Structure

--------------------------------------------------------------------------------- HASHING TABLE & BINARY TREE ---------------------...