Questions tagged [arrays]
For questions regarding the data storage structure of an Array. This can range from their standard indexing to their usage in comparison to other data structures. Arrays are an ordered list of elements which are usually all of the same type. Nested arrays can contain arrays as elements.
10
questions
1
vote
1
answer
59
views
Is there an array-like data type in Java that can cope with generic types better than the built-in array?
TL;DR I'm looking for a replacement for the primitive array data type in Java that works better with generic data types.
Background: I'm teaching A level CS in the UK (age 16-18) and we're using Java ...
18
votes
10
answers
4k
views
How to respond to the two-handed approach to swapping
I was introducing lists to someone young (in Scratch). Creating a list is boring, so I opted to introduce something that you can do with lists, but requires some thinking: swapping. I introduced it by ...
11
votes
4
answers
3k
views
Array or vector? Two dimensional array or matrix?
I'm from Brazil and I'm involved with programming language teaching for, at least, ten years. I have a background in computer science and my colleagues tend to use the term ...
6
votes
5
answers
931
views
What is a good teaching example/application for jagged arrays (2d arrays with irregular row lengths)?
We are teaching an AP CS class and the topic of 2d-arrays is coming up. There are plenty of cool and approachable sample applications for standard rectanglular arrays - matrix math, MIDI music, sudoku,...
-1
votes
1
answer
185
views
Why does array index not start from -1 why have indexes to be positive? [closed]
Arrays start from 0 then 1,2... But why are indexes positive, why are indexes not negative?
188
votes
31
answers
43k
views
Why do we count starting from zero?
In computer science, we usually count starting from 0. Is there any effective way to explain why, to new programmers who ask why?
I've read a bunch of different sources that list several reasons for ...
7
votes
6
answers
455
views
Single-dimensional array and simple looping activities of significance
I give a lab on single-dimensional loops and arrays. By "single dimensional loops", I mean that there is no nesting of loops. (I will later give a second lab on multi-dimensional loops and arrays, ...
45
votes
21
answers
5k
views
Real life examples of 0-indexing
It can be perplexing for students to begin counting at 0 when they enter a CS class. I made it a point over and over to talk about "Day 0" and "Week 0" in the opening days and weeks just to build ...
12
votes
7
answers
770
views
Lesson Idea: Arrays, Pointers, and Syntactic Sugar
One of the most challenging concepts to instill in new CS students is 0-indexing (indeed, the pedagogy of this fact probably merits its own discussion). Another difficult topic -- although a slightly ...
1
vote
2
answers
211
views
What kind of game (in Scratch) would require use of a list? [closed]
I teach an introductory Scratch class to a group of elementary-school students. Most of the focus is on having fun creating simple games, but i still try to introduce a little higher-level programming ...