Tutor profile: Rephael C.
Questions
Subject: Javascript Programming
How do I make a variable with a specific data type?
The cool thing about Javascript is that you do not have to explicitly define your data type before you declare your variable, as you have to do in C++. Javascript is smart enough to recognize the data type you want. If you create a new variable and set it equal to 5, Javascript will know to make that variable an integer. Similarly, if you set a new variable equal to a string, Javascript will make that variable into a string.
Subject: Computer Science (General)
What are the types of data structures in computer science?
Data structures are extremely important in computer science. Choosing the best data structure can be the determining factor of how fast your program runs. For example, arrays are data structures but only have limited use. You should only use arrays if you know exactly how many elements you need and do not need to change the size of it. There are many, many data structures but the main two types can be split by data structures using pointers and data structures not using pointers. For example, arrays, vectors and hash tables do not use pointers. However, doubly-linked-lists, maps and binary search trees all use pointers.
Subject: C++ Programming
What is a pointer and what is it used for?
Think of a pointer like another data type such as int, double, etc. except that the data that it holds is a memory address of something. Every variable in your program has a memory address. A pointer can "point" to it by setting it's value to the memory address of that variable. Pointers are very important in C++ programming and dynamic memory. One of the many uses of pointers is in data structures, such as linked-lists. In linked-lists, you can easily insert and delete things in it without affecting any of the other elements in the list. You cannot do that in a data structure like a vector. If you delete something in the middle of the vector, all of the elements past that removed element have to be shifted down to close the space. You can see how inefficient that can be if the data structure is large.