clash of clans data structures

26
CLASH OF CLANS םםםםם םםםםםם

Upload: ran-silberman

Post on 10-Jan-2017

65 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Clash of clans   data structures

CLASH OF CLANS

נתונים ומבני

Page 2: Clash of clans   data structures

אני ?מי

Page 3: Clash of clans   data structures

המשחק של טכנולוגיים אתגריםגרפיקה טלפונים של הפעלה מערכות אינטרנט תקשורת – רגע בכל זמינים שרתים שרידות אקספוננציאלית גדילה

Page 4: Clash of clans   data structures

דרישות - נתונים מבני מאוד גדולות רשימות בתוך מהירים חיפושים

חיפושClans חיפושOpponents

Page 5: Clash of clans   data structures

CLAN SEARCH

Page 6: Clash of clans   data structures

CLAN SEARCH

Page 7: Clash of clans   data structures

) לינארי ) קווי חיפוש

Page 8: Clash of clans   data structures

במדבר אריה לתפוס איך

Page 9: Clash of clans   data structures

בינרי חיפוש

Page 10: Clash of clans   data structures

לינארי סיבוכיות בחיפוש: לינארי לחיפוש ביותר הטובה התוצאה מה

1: לינארי בחיפוש ביותר הגרועה התוצאה מה

= האברים nמספר

Page 11: Clash of clans   data structures

בינרי בחיפוש סיבוכיות: בינרי לחיפוש ביותר הטובה התוצאה מה

1: בינרי בחיפוש ביותר הגרועה התוצאה מה

Log2(n)

Page 12: Clash of clans   data structures

? לוגריתם מהושל, b = xבחזקת aאם לוג a = bבבסיס xאזיloga(x) = bאזי ab=xאם

823: = 1דוגמא : כן log2(8) = 3על 932: = 2דוגמא : כן log3(9) = 2על 1000 = 103: 2דוגמא : כן log10(1000) = 3על

Page 13: Clash of clans   data structures

? לוגריתם מהוlog2(32) = ?

5log5(125) =?

3log10(1000000) = ?

6

Page 14: Clash of clans   data structures

בינרי לחיפוש סיבוכיות חישובבמערך האברים n = 9מספר

שעשינו האיטרציות k = 4מספר

Page 15: Clash of clans   data structures

בינרי לחיפוש סיבוכיות חישובבגודל מערך :nנתון בחצי. קטן הוא איטרציה בכל

איטרציה n/2גודלו 1לאחרגודלו שנייה איטרציה : n/22לאחר .n/23שלישית.

בגודל kבאיטרציה והמערך לאיבר 1נגיע: =< n/2k = 1לכן: n = 2kומכאן

לוג :2נוציא המשוואה צידי משניk = log2(n) >= המקסימלי האיטרציות מספר

:// . . / - -2- /http www miniwebtool com log base calculator

Page 16: Clash of clans   data structures

CLAN SEARCH

Page 17: Clash of clans   data structures

קריטריונים כמה לפי חיפוששלנו ובדוגמא

ה Clanשם מלחמות תדירותמיקום חברים מספרClan PointsClan Level

Page 18: Clash of clans   data structures

CLANמבנה

Clan

רמה נקודות מס' חברים שם

Page 19: Clash of clans   data structures

אחיד מבנה הרשומות לכלName: Clannly•#members: 5•Points: 100•Level: 7Name: Bad-Guys•#members: 12•Points: 7002•Level: 6Name: Defenders•#members: 10•Points: 10123•Level: 7

Page 20: Clash of clans   data structures

ממוינים אינדקסיםName: Clannly•#membs: 5•Points: 100•Level: 7Name: Bad-Guys•#members: 12•Points: 7002•Level: 6Name: Defenders•#members: 10•Points: 10123•Level: 7

Name• Bad-

Guys• Clan

ny• Defe

nders

Members• 5• 10• 12

Level• 6• 7• 7

Page 21: Clash of clans   data structures

אינדקס לפי חיפוש

Name: Clannly•#membs: 5•Points: 100•Level: 7

Name: Bad-Guys•#members: 12•Points: 7002•Level: 6

Name: Defenders•#members: 10•Points: 10123•Level: 7

Name• Bad-

Guys• Clan

ny• Defe

nders

Members• 5• 10• 12

Level• 6• 7• 7

Search Clans: Defenders

Page 22: Clash of clans   data structures

אינדקס לפי חיפוש

Name: Clannly•#membs: 5•Points: 100•Level: 7

Name: Bad-Guys•#members: 12•Points: 7002•Level: 6

Name: Defenders•#members: 10•Points: 10123•Level: 7

Name• Bad-

Guys• Clan

ny• Defe

nders

Members• 5• 10• 12

Level• 6• 7• 7

Level: 7

Page 23: Clash of clans   data structures

? רשימה ממיינים איך

Page 24: Clash of clans   data structures

? רשימה ממיינים איך בועות מיון

Page 25: Clash of clans   data structures

: בועות ;var items = [9,7,1,5,3,4,2,6,8]מיוןfunction bubbleSort(items) {

var length = items.length;for (var i = 0; i < length; i++) { for (var j = 0; j < (length - i - 1); j++) {

if(items[j] > items[j+1]) { var tmp = items[j]; items[j] = items[j+1]; items[j+1] = tmp; }

} } return items;

}

Page 26: Clash of clans   data structures