Questions tagged [search]

Questions about search algorithm mechanics and implementation. *NOT* for questions about using search tools within an API (e.g. Google, Bing, Facebook).

Searching is one of the most common and important tasks in Computer Science.

The most basic search algorithm is a (also called "sequential search"). Each item in a collection of data is examined in sequence until the sought item is found.

If the collection in question has already been sorted, for instance, then a more efficient is possible.

Search can become more complex when, rather than finding one instance of a specific item, we want to find all items meeting a certain set of criteria. For instance a query can specify extremely complex search criteria, and much of relational database design involves the planning of an efficient way to perform those searches.

Another more complex search scenario is graph search, in which a series of nodes and edges must be traversed. Common algorithms for this domain include and . In many cases, a heuristic search algorithm such as can achieve more efficient results by making use of additional information about the problem.


Do not use this tag for questions about specific search tools within an API. Some more relevant tags for that would be the following:

37207 questions
7
votes
1 answer

Ordering sql query by first letter

I am trying to order my mysql queries based on the first letter but every method I have used is restricting my search. Example MySQL table Value computer services abc computer services dynamic computer services If I search for computer services I…
James Bell
  • 604
  • 1
  • 7
  • 18
7
votes
2 answers

TemplateInputException: Error resolving template ****, template might not exist

Im using SpringBoot with a mySql database. I am trying to filter search through a table of teams. Initially this table was a thymeleaf table (see my related SO questions) but after exhausting all resources available on the internet, to no success I…
KirstenKali
  • 443
  • 3
  • 8
  • 16
7
votes
2 answers

search GitHub for projects with specific Framework & Demo

I'd like to search GitHub (and maybe Gitlab, Bitbucket & Co) for repositories that have a GitHub Page (meaning they should most likely have a gh_pages branch) or a demo at Firebase, Heroku etc. Also I would like to easily search for repos which use…
Night Train
  • 2,383
  • 3
  • 18
  • 35
7
votes
2 answers

How do I get line previews in Eclipse's context intelligent 'Java Search' (vs. context unaware 'File Search')

When using the search functionality in Eclipse, especially, for example, a Java method or field, the 'reference in workspace'. (Control+Shift+G) when the the cursor is on some method, say. How do you have the search results show you the one line…
Matt S.
  • 878
  • 10
  • 21
7
votes
0 answers

Chrome Dev Tools - search in html doc not working with equal sign and quotation mark in between

I have this problem since a long time in Chrome Dev Tools: I'm using Chrome 63 here, but I'm shure I had it also 5 years ago. (hint: the square brackets around the search examples do NOT belong to the search strings) Description: I want to search…
7
votes
1 answer

Django Queryset for concat query fullname of first_name and last_name

I would like to do a fullname (first_name concat last_name) search/query in Django. The following is my model: class Employee(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='employee') company =…
Axil
  • 3,606
  • 10
  • 62
  • 136
7
votes
2 answers

Emacs: How to delete a line starting with specific text

How can I find and delete lines which start with the text in? I use the command C-M-s ^in to find all lines starting with in, but then I don't really know what to do.
7
votes
1 answer

How to search in Visual Studio Code using regex to match only uncommented code?

For example, I have the following lines: //sys.log(siteNameToPrepare); //sys.log(siteNameToPrepare); // sys.log("downloadFolder: "+downloadFolder); // lorem ipsum ... arbitrary codes here... var a = _POST; …
Artan
  • 91
  • 1
  • 1
  • 9
7
votes
3 answers

given an array of sorted ints, find the most frequently occuring element in log(n)

It's easy to find the most frequently occurring element in O(n). Is there a faster algorithm (O(logn)) to do this? (given the array is sorted)
One Two Three
  • 22,327
  • 24
  • 73
  • 114
7
votes
1 answer

Why do I get: null cannot be cast to non-null type android.widget.SearchView ?

I am trying to implement the "search widget" on my Menu Bar.. But I am getting the error: "null cannot be cast to non-null type android.widget.SearchView".. I did sme attempts to solve the problem, but no result.. Could you give me some hints?…
MisterNowhere
  • 605
  • 1
  • 6
  • 13
7
votes
4 answers

Take every k-th element from the (1 .. n) natural numbers series

For example, we have series 1, 2, 3, 4, 5. We take every 3 element => 3, 1, 5, 2, 4 (chosen element shouldn't remain, we can take while series is not empty). Naive implementation by circle doubly linked list is not good idea cause of performance.…
Evgeniy
  • 171
  • 3
  • 9
7
votes
2 answers

Remove an item from a Set that doesn't match criteria

For a school project, the goal is to do a fuzzy match of a query string to a lyric string inside a Song object. The overall data structure is a TreeMap of unique words paired with sets of songs that contain that word in the lyrics. I have my…
Jason
  • 11,263
  • 21
  • 87
  • 181
7
votes
1 answer

Elasticsearch return all documents of a given type

I have been searching for a solution to this question for a few days. Use case is to simply see the documents of a particular type only. Usually after googling for a long time I end up with some search queries with wildcards. I have gone through…
cutteeth
  • 2,148
  • 3
  • 25
  • 45
7
votes
7 answers

Like statement across multiple columns in SQL

I'm trying to query a like statement across multiple columns. I have the following search terms: 'dog' 'cat' 'rabbit' 'gerbil' 'guinea pig' 'hamster' and I need search for these terms or terms LIKE these in the 'animals' table which has about 40…
AneeshaKK
  • 95
  • 1
  • 1
  • 8
7
votes
4 answers

Bash. The quickest and efficient array search

I need to do an array search so many time in a bash process. I need to know what is the most quick and efficient way to do it. I know how to do it. The point of the question os how to do it in the fastest way. Now, I'm doing in this…
OscarAkaElvis
  • 5,384
  • 4
  • 27
  • 51