Answers for "define vector"

C++
36

c++ vector

#include <vector>

int main() {
  std::vector<int> v;
  v.push_back(10); // v = [10];
  v.push_back(20); // v = [10, 20];
  
  v.pop_back(); // v = [10];
  v.push_back(30); // v = [10, 30];
  
  auto it = v.begin();
  int x = *it; // x = 10;
  ++it;
  int y = *it; // y = 30
  ++it;
  bool is_end = it == v.end(); // is_end = true
  
  return 0;
}
Posted by: Guest on March-17-2020
5

what is vector

Array based data structure
-It is synchronized - thread safe.
-It is mostly used in multi-threaded environment.
-It is much slower than ArrayList because it is
thread-safe
Posted by: Guest on January-06-2021
10

vector

In mathematics, physics and engineering, a Euclidean vector
is a geometric object that has magnitude and direction. 
Vectors can be added to other vectors according to vector algebra

Examples include:

1.)displacement
2.)velocity
3.)position
4.)force
5.)torque
Posted by: Guest on October-28-2020

Browse Popular Code Answers by Language