Ask the web
with the leading AI models
See your book's real images, tables, code and math in your answer. Click any part to open its exact source on the page.
Free plan. No credit card needed.p.103 has the node layout, Figure 4.2 and the struct Node code. p.182 compares the expected search paths: 2 log n + O(1) in a skiplist, 2 ln n + O(1) ≈ 1.386 log n + O(1) in a Treap. The arXiv benchmark agrees: treap queries took 234 s against 360 s for the skip list. Show the figure, the code and the formula from the book, then the web result.
A skiplist node holds one value and an array, next, of pointers, so the data, x, in a node is stored only once, even though x may appear in several lists. p.103
SkiplistSSet
struct Node {
T x;
int height; // length of next
Node *next[];
};The expected search path is in a Treap and in a skiplist, so the search paths in a Treap are considerably shorter. p.182
On the web, a 2026 benchmark agrees: treap queries took 234 s against 360 s for a skip list, which has "more nodes traversed on average". arxiv.org
Open Data Structures C++
Figure 4.2: The search path for the node containing 4 in a skiplist.
as consisting of a data value, x, and an array, next, of pointers, where u.next[i] points to u’s successor in the list Li. In this way, the data, x, in a node is stored only once, even though x may appear in several lists.
struct Node { T x; int height; // length of next Node *next[]; };
The next two sections of this chapter discuss two different applications of skiplists. In each of these applications, L0 stores the main structure (a list of elements or a sorted set of elements). The primary difference between these structures is in how a search path is navigated; in particular, they differ in how they decide if a search path should go down into Lr−1 or go right within Lr.
4.2 SkiplistSSet: An Efficient SSet
A SkiplistSSet uses a skiplist structure to implement the SSet interface. When used in this way, the list L0 stores the elements of the SSet in sorted order. The find(x) method works by following the search path for the smallest value y such that y ≥ x:
Node* findPredNode(T x) {
89
It is worth comparing the Treap data structure to the SkiplistSSet data structure. Both implement the SSet operations in O(log n) expected time per operation. In both data structures, add(x) and remove(x) involve a search and then a constant number of pointer changes (see Exercise 7.5 below). Thus, for both these structures, the expected length of the search path is the critical value in assessing their performance. In a SkiplistSSet, the expected length of a search path is
In a Treap, the expected length of a search path is
Thus, the search paths in a Treap are considerably shorter and this translates into noticeably faster operations on Treaps than Skiplists. Exercise 4.7 in Chapter 4 shows how the expected length of the search path in a Skiplist can be reduced to
by using biased coin tosses. Even with this optimization, the expected length of search paths in a SkiplistSSet is noticeably longer than in a Treap.
7.3 Discussion and Exercises
Random binary search trees have been studied extensively. Devroye [19] gives a proof of Lemma 7.1 and related results. There are much stronger results in the literature as well, the most impressive of which is due to Reed [62], who shows that the expected height of a random binary search tree is
where is the unique solution on the interval of the equation and . Furthermore, the variance of the height is constant.
168
- SearchFast, focused search
- Deep searchDeeper search across your library and the web
- Short
- Balanced
- Detailed
- Books & FilesSearch your Books and files
- Book Notes & HighlightsSearch your highlights, comments and sticky notes
- Web searchSearch the public web
- Community searchReddit, Hacker News, Stack Overflow, GitHub
- Auto
- GPT-6 LunaNew
- Claude Haiku 5.5
- DeepSeek V4.1 Flash
- Gemini 3.5 Flash-Lite
- Claude Sonnet 5.5Pro
- GPT-6.1 TerraPro
- GPT-6.1 SolPro
- Gemini 3.1 ProPro
- DeepSeek V4 ProPro
- Kimi K3.1 ProPro
- Claude Opus 5.5Max
- Gemini 4 ArgonMax
Coded animation, not a recording: HTML, CSS and a little script (no images, no video file), styled from the app's own code (AppHeader, AskPanel, TurnRow, AnswerRenderer, BookTabsBar, PdfReader, globals.css). It plays only while on screen and shows the last frame to people who turn off motion. Content: Open Data Structures p.103 and p.182 (CC BY), as our index stores them, and a 2026 arXiv benchmark (De Man and Dhulipala, arXiv:2609.14746).
Same PDF page, other apps
See what each app keeps.
A free book, Open Data Structures (CC BY). The real page on the left. Pick an app on the right to see what it reads from that page.
Eslam decides the heading: this one, or his approved "Most AI apps read your book as plain text."
The figure stays in place, and the code stays a code block.The math stays math.Both tables stay tables, row by row.



"For PDFs from 101 to 1000 pages, Claude processes text only and doesn't analyze visual elements."
SkiplistSSet: An Efficient SSet §4.2
L5
L4
L3
L2
L1
L0 0 1 2 3 4 5 6
sentinel
Figure 4.2: The search path for the node containing 4 in a skiplist.
as consisting of a data value, x, and an array, next, of pointers, where
u.next[i] points to u’s successor in the list Li . In this way, the data, x, in
a node is stored only once, even though x may appear in several lists.
SkiplistSSet
struct Node {
T x;
int height; // length of next
Node *next[];
};
The next two sections of this chapter discuss two different applica-
tions of skiplists. In each of these applications, L0 stores the main struc-
ture (a list of elements or a sorted set of elements). The primary difference
between these structures is in how a search path is navigated; in partic-
ular, they differ in how they decide if a search path should go down into
Lr−1 or go right within Lr .
4.2 SkiplistSSet: An Efficient SSet
A SkiplistSSet uses a skiplist structure to implement the SSet interface.
When used in this way, the list L0 stores the elements of the SSet in sorted
order. The find(x) method works by following the search path for the
smallest value y such that y ≥ x:
SkiplistSSet
Node* findPredNode(T x) {
89
Discussion and Exercises §1.8
SSet implementations
find(x) add(x)/remove(x)
SkiplistSSet O(log n)E O(log n)E § 4.2
Treap O(log n) E O(log n)E § 7.2
ScapegoatTree O(log n) O(log n)A § 8.1
RedBlackTree O(log n) O(log n) § 9.2
BinaryTrieI O(w) O(w) § 13.1
XFastTrieI O(log w)A,E O(w)A,E § 13.2
YFastTrieI O(log w)A,E O(log w)A,E § 13.3
(Priority) Queue implementations
findMin() add(x)/remove()
BinaryHeap O(1) O(log n)A § 10.1
MeldableHeap O(1) O(log n)E § 10.2
I This structure can only store w-bit integer data.
Table 1.2: Summary of SSet and priority Queue implementations.
1.8 Discussion and Exercises
The List, USet, and SSet interfaces described in Section 1.2 are influ-
enced by the Java Collections Framework [54]. These are essentially sim-
plified versions of the List, Set, Map, SortedSet, and SortedMap inter-
faces found in the Java Collections Framework.
For a superb (and free) treatment of the mathematics discussed in this
chapter, including asymptotic notation, logarithms, factorials, Stirling’s
approximation, basic probability, and lots more, see the textbook by Ley-
man, Leighton, and Meyer [50]. For a gentle calculus text that includes
formal definitions of exponentials and logarithms, see the (freely avail-
able) classic text by Thompson [71].
For more information on basic probability, especially as it relates to
computer science, see the textbook by Ross [63]. Another good reference,
which covers both asymptotic notation and probability, is the textbook by
Graham, Knuth, and Patashnik [37].
Exercise 1.1. This exercise is designed to help familiarize the reader with
25
ArrayStack: Fast Stack Operations Using an Array §2.1
or remove(i) is at least
r
X
(ni /2 − 1) ≤ m ,
i=1
which is equivalent to
r
X
ni ≤ 2m + 2r .
i=1
On the other hand, the total time spent during all calls to resize() is
r
X
O(ni ) ≤ O(m + r) = O(m) ,
i=1
since r is not more than m. All that remains is to show that the number
of calls to add(i, x) or remove(i) between the (i − 1)th and the ith call to
resize() is at least ni /2.
There are two cases to consider. In the first case, resize() is being
called by add(i, x) because the backing array a is full, i.e., a.length = n =
ni . Consider the previous call to resize(): after this previous call, the
size of a was a.length, but the number of elements stored in a was at
most a.length/2 = ni /2. But now the number of elements stored in a is
ni = a.length, so there must have been at least ni /2 calls to add(i, x) since
the previous call to resize().
The second case occurs when resize() is being called by remove(i)
because a.length ≥ 3n = 3ni . Again, after the previous call to resize()
the number of elements stored in a was at least a.length/2 − 1.1 Now
there are ni ≤ a.length/3 elements stored in a. Therefore, the number of
remove(i) operations since the last call to resize() is at least
R ≥ a.length/2 − 1 − a.length/3
= a.length/6 − 1
= (a.length/3)/2 − 1
≥ ni /2 − 1 .
In either case, the number of calls to add(i, x) or remove(i) that occur
between the (i −1)th call to resize() and the ith call to resize() is at least
ni /2 − 1, as required to complete the proof.
1 The − 1 in this formula accounts for the special case that occurs when n = 0 and
a.length = 1.
35
The figure is gone: only its labels are left ("L5 … L0", "0 1 2 3 4 5 6"). The code keeps its lines.Both tables become text lined up with spaces: no rows or cells left.Each sum becomes an "X" with "i=1" on the line below.
"You can upload textual files, including plain text, code, or PDFs…"
"If you upload a long file, Perplexity will extract the most important parts to provide the most relevant response to your query."
Perplexity reads a PDF as a text file, and on a long book it uses only the parts it picks.
Side by side
| Search one or multiple books, a folder, a #tag or your whole library | One notebook at a time | Per project | Per project | — | |
|---|---|---|---|---|---|
| Sees the images in your PDFs | Picture kept, but loses its position in the page1 | Up to 100 pages; text only above2 | Yes in chat; may skip them in project files3 | Lists PDFs as text files4 | |
| Reads tables cleanly and shows them in your answer | The book's own table | Rewritten by the AIIts copy of the page turns tables into run-on text5 | Rewritten by the AI | Rewritten by the AI | Rewritten by the AI |
| Reads code cleanly and shows it in your answer | The book's own code | Rewritten by the AIIts copy of the page runs code into one line1 | Rewritten by the AI | Rewritten by the AI | Rewritten by the AI |
| Reads math cleanly and shows it in your answer | The book's own formula | Rewritten by the AIIts copy of the page splits sums over lines1 | Rewritten by the AI | Rewritten by the AI | Rewritten by the AI |
| A cloud library for your books | Per notebook | Per project | Library and projects3 | — | |
| Click any part to open its exact spot on the real page | — | — | — | — | |
| A voice tutor that marks your page | — | — | — | — |
Rewritten by the AI: their answer is text the model writes; none of their help pages says it shows the book's own table, code or formula. — not stated in their help pages (read 9 Nov 2026). 1 Our test on this book, free plan, 3 Nov 2026. 2 Claude Help Center, updated 23 Jul 2026. 3 OpenAI Help Center, read 9 Nov 2026. 4 Perplexity Help Center, read 9 Nov 2026. 5 Our test on this book (page 39), free plan, Nov 2026.
Pages drawn from the real PDF (Downloads/Open Data Structures C++.pdf). The AskLatte tab is drawn from the real index (one-time export, assets/asklatte-index-ods.json; figure cut at the parser's box). For the live site the JSON and figure go to assets.asklatte.com (not uploaded yet). Gemini shots from Eslam's Notion page (the red label is his note); re-take before launch. ChatGPT's page now says it reads images in PDFs (changed since our 26 Sep check). Quotes from help pages; re-check on launch day.
Every source is a page
Click any source. The real page opens.
Tables, formulas, code and figures sit inside the answer. Click one and the page opens beside it, with the words marked when they're found. A web quote opens the live page at that line.
Poster: GPT-6 Luna, our test PDF (Notion page). The loop: pill → page with the words boxed → a table/formula/code card → its spot flashes → one web quote that opens the live page. Recorded on Open Data Structures.
Voice tutor
Meet Latte, the AI voice tutor for your books
Ask Latte anything about your page or book in a live conversation. It explains with its own pen, right on your page.
Free: 10 minutes a week. Pro: 90.
Poster is from Grokking Data Structures (a paid book) on Sonnet: placeholder only. The clip is recorded on an Open Data Structures figure, Vision ON, a model on the live Free Latte list.
Web · models · deep search
Everything you use AI search for, too.
Web answers
Each web quote shows the site and the day it was read. "Open source" opens the live page at the quoted line.

Pick a model for each question
Claude, GPT, Gemini, DeepSeek and Kimi. Free: 4 models, plus Claude Sonnet 5.5 three times a day.
Deep search shows its steps
For a big question it plans, reads book pages and web pages, and shows each step as it goes. It takes minutes, not seconds.

Ask one book, a folder or a #tag
Type @ to pick a book or a whole folder, or # for a tag. Only those books are searched.

Stills are placeholders. Re-shoot: a web quote whose sentence is right, a claim list where every claim matches its page, the folder card without the red box, and no people icon (community search is off) in the Ask bar.
Prefer to stay in Claude or ChatGPT?
Connect your AskLatte library through MCP. Free: 50 calls a day.
Plans
Start free. Go Pro when you need more.
- 5 searches and 5 Deep searches a day
- 4 models, plus Claude Sonnet 5.5 three times a day
- 3 book uploads a day
- 50 image analysis credits a month
- Latte: 10 minutes a week
- MCP: 50 calls a day
- 30 searches and 30 Deep searches a day
- Every model, Pro models 10 times a day
- 30 book uploads a day
- Scanned books: 1,000 pages a month
- 3,500 image analysis credits a month
- Latte: 90 minutes a week
The PDF and EPUB reader, highlights and global search are free on every plan.
Numbers from prod Helm (local checkout of 1 Nov); the page reads them from the plans API. "Pro models 10 times a day" becomes 30 only after the 8 Nov change ships.
Questions
Common questions
Why not just use Perplexity, ChatGPT or Claude?
They answer from the web well, and so does AskLatte. The difference is your books: the answer keeps their real tables, code, math and figures, one click opens the real page, and Latte explains it out loud with a pen on that page.
Which files work?
PDF and EPUB, plus Markdown, text, CSV and images. Scanned PDFs come with Pro. Password-protected PDFs and books locked in DRM readers cannot be uploaded.
What if the exact words aren't found?
The source still opens the right page; it just has no words marked. Those sources look different, so you know.
Which AI models can I use?
Claude, GPT, Gemini, DeepSeek and Kimi. Free: 4 models, plus Claude Sonnet 5.5 three times a day. Pro: every model.
Is my data private? Is it used for training?
Your books and questions are never sold or used to train our models. Data is encrypted in transit and stored in the US (AWS). You can delete everything any time.
What is Latte?
A voice tutor in the PDF reader. Ask out loud; it answers with voice and subtitles and marks the page as it talks, even the labelled parts of a figure.
