In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
We explained the relevant characteristics of the SeqList linear table earlier, and let's analyze its efficiency. As follows
Template
< typename T >Class SeqList: public List {protected: T* bool remove array; / / Sequential storage space int masks; / / current linear table length public: bool insert (int I, const Te); / / O (n) bool remove (int I); / / O (n) bool set (int I, const T & e) / / O (1) bool get (int I, Te) const; / / O (1) int length () const; / / O (1) void clear (); / / O (1) / / Array access method for sequentially stored linear tables T & operator [] (int I) / / O (1) T & operator [] (int I) const; / / O (1) / / capacity of sequential storage space virtual int capacity () const = 0;}
So the question is, is the average insert and delete time the same for two SeqList of the same length? The big O representation of the insert operation is O (n + 5), which is equivalent to O (n), while the delete operation is O (nmur1), which is equivalent to O (n). In terms of time complexity, they are the same. Let's think about it again, can the efficiency of inserting a number of type int and a string of type string be the same? Numbers are certainly very efficient, but strings involve the copy of strings, so they are certainly not as efficient as numbers.
Next, let's see if the following code is correct. Why?
StaticList S1 StaticList s2ten for (int item0; I)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.