Dr. Thomas Hicks Computer Science Department Trinity University - PowerPoint PPT Presentation

Dr. Thomas Hicks Computer Science Department Trinity University

1 / 38

Dr. Thomas Hicks Computer Science Department Trinity University

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

1. 1320Principles Of Programming I Chapter 7-BArray Functions Dr. Thomas Hicks Computer Science Department Trinity University 1 6

2. Storage OfActNo (Review)

3. Use arr(0)  To Store ActNo 6 0 7 5 2 4 3 0 5 2 1 1 ActNo  5 0 nos

4. Time System.nanoTime

5. System.nanoTime

6. arr.drop(n) Return An Array, Or List, With The First N Elements Removed

7. arr.drop(n) • Explicitly returns an Array, or List, with n elements removed from the front.

8. arr.init Return An Array, Or List, With The Last Element Removed

9. arr.init • Explicitly returns an Array, or List, with n elements removed from the rear.

10. arr.head & arr.first Return The First Element Of The Array Or List

11. arr.head & arr.first • Explicitly returns the first element in the Array or List.

12. arr.last Return The Last Element Of The Array Or List

13. arr.last • Explicitly return the Last Element in the Array or List.

14. arr.slice(f,l) Return The Array, or List, Beginning With Element f & Continuing To The Element Just Before l

15. arr.slice(f,l) • Explicitly returns an Array, or List, Beginning With Element f & Continuing To The Element Just Before Element l.

16. arr.splitAt(n) Return A Tuple Containing Two Arrays  The First Array Contains The First Portion Of The List (Up To, But Not Including Element n)  The Second Array Contains The Items From Element n To The End.

17. arr.splitAt(n) • Explicitly Return A Tuple Containing Two Arrays  The First Array Contains The First Portion Of The List (Up To, But Not Including Element n) The Second Array Contains The Items From Element n To The End..

18. arr.take(n) Return The Array, or List, Of n Elements Taken From The Beginning/Left

19. arr.take(n) • Explicitly Return The Array, or List, Of n Elements Taken From The Beginning/Left • .

20. arr.takeRight(n) Return The Array, or List, Of n Elements Taken From The End/Right

21. arr.takeRight(n) • Explicitly Return The Array, or List, Of n Elements Taken From The End/Right • .

22. arr.contains(n) Return true If n Is In The List Or Array

23. arr.contains(n) • Explicitly Return trueIf n Is One Of The Data Element Members Of The List Or Array; Otherwise Return false • .

24. arr.isEmpty Return true If The Array, Or List, Is Empty – Has 0 Data Element Members

25. arr.isEmpty • Explicitly Return trueReturn true If The Array, Or List, Is Empty – Has 0 Data Element Members; Otherwise Return false • .

26. arr.nonEmpty Return true If The Array, Or List, Is Empty – Has 0 Data Element Members

27. arr.nonEmpty • Explicitly Return trueReturn true If The Array, Or List, Is Empty – Has At Least 1, or more, Data Element Members; If Empty, Return false • .

28. arr.startsWith(arr) Return true If The Array, Or List, Is Starts With The PassedArray

29. arr.startsWith(arr1) • Explicitly Return true If The Array, Or List, Is Starts With The Passed Array. • .

30. arr.indexOf(n) Return The Element Subscript If The n Is A Member Of The Array, or List; Return -1 If The Element Is Not In The Array Or List

31. arr.indexOf(n) • Explicitly Return The Element Subscript If The n Is A Member Of The Array; Return -1If The Element Is Not In The Array.

32. arr.lastIndexOf(n) Return The Element Subscript If The n Is A Member Of The Array, Or List; Return -1 If The Element Is Not In The Array Or List

33. arr.lastIndexOf(n) • Explicitly Return The Element Subscript If The n Is A Member Of The Array; Return -1 If The Element Is Not In The Array.

34. arr.diff(arr1) Return An Array, Or List, Containing Those Elements In arr1, That Are Not In arr.

35. arr.diff(arr1) • Explicitly Return An Array Containing Those Elements In arr, That Are Not In arr.

36. arr.reverse Return An Array, Or List, Whose Elements Are In Reverse Order

37. arr.reverse • Explicitly Return An Array Whose Elements Are In Reverse Order.

38. Principles Of Programming ICSCI 1320 Dr. Thomas E. Hicks Computer Science DepartmentTrinity University Textbook: An Introduction to Programming with ScalaBy Dr. Mark Lewis Special Thanks To Dr. Mark Lewis For Providing Some Of Text For Use In This Presentation.