Here's an example of a Melodic Pattern in C Major.
The Pattern starts on C and then climbs starting next on D.
e-----------------------------------------------------------------------
B-----------------------------------------------------------------------
G-----------------------------------------------------------------------
D---------------------------7------------------------7----9--7---------
A---------------7--8--10------10--8--7-------8--10-------------10--8--
E------------8-----------------------------10---------------------------
Try to continue the sequence up each note of the C Major Scale to the Octave; C-D-E-F-G-A-B-C
Then Descend back to the Root using the same sequence.
It's more difficult to accomplish, compared to ascending up the scale in triplets, for example.
Should you become lost at a certain point, there are formulas that can be used for the correct sequence, until the ear can develop.
The formula for the above can be converted using Intervals of C Major.
C=1, D=2, E=3, F=4, G=5, A=6, B=7, C=8, D=9, E=10, F=11, G=12, A=13, B=14 (it's easier counting up 2 Octaves).
Now convert the Fretted number notes to it's Interval notes;
Example; E---------8= the C note=(1);;; and A--------------7= E note=(3)
So, the order to the sequence of notes would be;
C-E-F-G-A-G-F-E---1-3-4-5-6-5-4-3.
D-F-G-A-B-A-G-F---2-4-5-6-7-6-5-4. Interval numbers of C Major.
The Intervals go up by adding 1 to the previous Intervals;
1-3-4-5-6-5-4-3
2-4-5-6-7-6-5-4
3-5-6-7-8-7-6-5
4-6-7-8-9-8-7-6
ETC,,,,,,,,,,,,,,,,,,
So,
7-9-10-11-12-11-10-9. are the notes B-D-E-F-G-F-E-D
there are countless Melodic patterns.